import { IPSAppDESearchView } from './ipsapp-desearch-view';
import { IPSAppDESearchView2 } from './ipsapp-desearch-view2';
import { PSAppDEViewImpl } from './psapp-deview-impl';
import { IPSCodeList } from '../../codelist/ipscode-list';

export class PSAppDESearchViewImpl extends PSAppDEViewImpl implements IPSAppDESearchView, IPSAppDESearchView2 {
  protected quickgrouppscodelist: IPSCodeList | null = null;

  getQuickGroupPSCodeList(): IPSCodeList | null {
    if (this.quickgrouppscodelist != null) return this.quickgrouppscodelist;
    const value = this.M.getQuickGroupPSCodeList;
    if (value == null) {
      return null;
    }
    this.quickgrouppscodelist = this.getPSModel4('codelist.IPSCodeList', value, 'getQuickGroupPSCodeList') as IPSCodeList;
    return this.quickgrouppscodelist;
  }

  get quickGroupPSCodeList(): IPSCodeList | null {
    return this.getQuickGroupPSCodeList();
  }

  getQuickGroupPSCodeListMust(): IPSCodeList {
    const value = this.getQuickGroupPSCodeList();
    if (value == null) {
      throw new Error('未指定快速分组代码表');
    }
    return value;
  }

  get enableQuickGroup(): boolean {
    return this.M.enableQuickGroup;
  }

  get enableQuickSearch(): boolean {
    return this.M.enableQuickSearch;
  }

  get enableSearch(): boolean {
    return this.M.enableSearch;
  }

  get expandSearchForm(): boolean {
    return this.M.expandSearchForm;
  }

  get loadDefault(): boolean {
    return this.M.loadDefault;
  }

  get cls(): string {
    return 'PSAppDESearchViewImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'app.view.IPSAppDESearchView' || cls == 'app.view.IPSAppDESearchView2') return true;
    return super.instanceof(cls);
  }
}
